<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>重置密码-农业知识交流论坛</title>
    <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{/css/login.css}">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_2080705_jiuqmw0ynch.css">
    <script th:src="@{/js/jquery-3.5.1.min.js}"></script>
    <script th:src="@{/layui/layui.all.js}"></script>
    <script th:src="@{/js/findjs.js}"></script>

</head>
<body>
<div class="container">

<div class="login-main row">
    <div class="main-content col-12 col-sm-10 col-md-8 col-lg-4">
        <div class="formDiv" id="formDiv">
            <h2 class="text-center">重置密码</h2>
            <form th:action="@{/findpwd}" method="post" id="formBtn" th:object="${registerForm}">
                <div class="dataform">
                    &nbsp;<i class="iconfont icon-denglu">&nbsp;</i>
                    <input id="userName" name="username" type="text" class="layui-input" required placeholder="你的账号"
                           maxlength="64" autocomplete="off" th:field="*{username}">
                    <div class="error-content">
                        &emsp;<span class="errMsg" id="userNameErr2" th:if="${#fields.hasErrors('username')}" th:errors="*{username}"></span>
                        <span id="userNameErr" class="errMsg" th:unless="${#fields.hasErrors('username')}"></span>
                    </div>

                    &nbsp;<i class="iconfont icon-mima">&nbsp;</i>
                    <input class="layui-input" type="password" name="password" placeholder="新密码" id="pwd" maxlength="20"
                           required th:field="*{password}">
                    <div class="error-content">
                        &emsp;<span class="errMsg" id="passwordErr2" th:if="${#fields.hasErrors('password')}" th:errors="*{password}"></span>
                    </div>

                    &nbsp;<i class="iconfont icon-mima">&nbsp;</i>
                    <input class="layui-input" type="password" name="repassword" placeholder="确认密码" id="repwd" maxlength="20"
                           required th:field="*{repassword}">
                    <div class="error-content">
                        &emsp;<span class="errMsg" id="passwordErr3" th:if="${#fields.hasErrors('repassword')}" th:errors="*{repassword}"></span>
                        <span class="errMsg" id="passwordErr" th:unless="${#fields.hasErrors('repassword')}" th:text="${pmsg}"></span>
                    </div>

                    <div class="btn-warp gap">
                        <div class="text-center">
                            <input type="hidden" value="jsform" id="_app">
                            <button type="button" id="btnFind" class="layui-btn layui-btn-radius layui-btn-normal lgbtn">重置密码</button>
                        </div>
                    </div>
                    <div class="error-content">
                        &emsp;<span class="errMsg" th:text="${msg}"></span>
                    </div>
                    <div class="gap">
                        <div class="pull-right" style="margin-top: 6px">
                            <a th:href="@{/toLogin}" class="link">去登录</a>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div th:replace="~{common/footer::footer}"></div>
</div>

</div>
<script type="text/javascript">


    function sendemailcode() {
        var username = document.getElementById("userName").value;
        var email = document.getElementById("email").value;

        $.ajax({
            url:"sendemailcode",
            type:"POST",
            data:$("#formDiv form").serialize(),
            success:function (data) {
                if(data.code==100){
                    $("#verifyErr").text("信息有误!");
                }else if(data.code==200){
                    $("#verifyErr").text("发送成功 5分钟内有效");
                }
            }
        })
    }


</script>
</body>
</html>